<?php 
header("Content-Type: text/html;charset=utf-8");
include("function/_nosql.php"); //
include("function/function.php");
include("_include.user.judge.php");
$kboy_userid = $_SESSION['kboy_userid'];
$kboy_user = $_SESSION['kboy_user'];
$action = chkstr(trim($_REQUEST['action']));
$id = chkstr(trim($_REQUEST['id']));

if($action=='shanchu'){//删除
$mysql = new sqlstr("kboy_forum_message"); 
$news_sql = $mysql -> deleteSql("id=$id");
$news_res = mysql_query($news_sql);
if($news_res){
$arr['status'] = 0;
}
else{
$arr['status'] = (-1);
}
echo json_encode($arr);
}elseif($action == 'dianzan'){
	if(getNewsNums("kboy_active_good","newsid=$id and uid=$kboy_userid") >0){//已经点过赞了
		$arr['status'] = (1);
	}
	else{
		$mysql = new sqlstr("kboy_forum_message"); 
		$message_good = getClassName("kboy_forum_message","message_good","id=$id");
		$message_good = $message_good+1;
		$mysql -> set("message_good",$message_good);
		$news_sql = $mysql -> updateSql("id=$id");
		$news_res = mysql_query($news_sql);
		mysql_query(" insert into `kboy_active_good`(`newsid`,`uid`) values( '".$id."' , '".$kboy_userid."' ) ");
		if($news_res){
		$arr['status'] = 0;
		}
		else{
		$arr['status'] = (-1);
		}
	}
	echo json_encode($arr);
}
else{
 echo erro('服务器内部错误');
}
/*if ($action=='delchildmsg' || $action=='shoucang' || $action=='shanchu') {
	echo '{"status":0}';
}else{
	// param: 0 成功  1 已经赞过 其他 失败
	echo '{"status":0,"home":"http://baidu.com","name":"陈红","head":"http://localhost/images/f_pic1_6.jpg"}';	
}*/
	
 ?>